<?php

use yii\db\Migration;

class m180328_031352_alter_wechat extends Migration
{
    private function createDb(){
        $dbinfo = \Yii::$app->params['web_db'];
        $this->db =\Yii::createObject($dbinfo);
    }

    public function safeUp(){
        $this->createDb();
        $this->addColumn('{{%wechat}}', 'payinfo_id', $this->integer()->defaultValue(null)->comment('商户信息id'));
    }

    public function safeDown()
    {
        $this->createDb();
        $this->dropColumn('{{%wechat}}', 'payinfo_id');

        return false;
    }

    /*
    // Use up()/down() to run migration code without a transaction.
    public function up()
    {

    }

    public function down()
    {
        echo "m180328_031352_alter_wechat cannot be reverted.\n";

        return false;
    }
    */
}
